package com.exception;

public class TryCatchDemo {
    public static void main(String[] args) {

        try {
            String str = null;
            int length = str.length();
            System.out.println("length = " + length);
            System.out.println("执行不到这里");
        } catch (NullPointerException e) {
            System.out.println("空指针异常");
        }
    }
}
